<?php

namespace app\common\model\Order;

use think\Model;
use traits\model\SoftDelete;

class OrderProduct extends Model
{
    protected $table = "pre_order_product";

    protected $append = [];
    // 更新时间
    protected $updateTime = false;

    protected $dateFormat = 'Y-m-d';

    // TODO 开启软删除
    use SoftDelete;
    protected $deleteTime = 'deletetime';

    public function product()
    {
        return $this->belongsTo('app\common\model\Product\Product', 'proid', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function order()
    {
        return $this->belongsTo('app\common\model\Order\Order', 'orderid', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function user()
    {
        return $this->belongsTo('app\common\model\User\User', 'userid', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
